<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
<title>通知存款计算器</title>
<link href="base.css" rel="stylesheet" type="text/css">
<link href="tool.css" rel="stylesheet" type="text/css">
<link href="art.default.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="artDialog.basic.js"></script>
<script type="text/javascript">
function tzsumcalc(){
	
	var tzInitSaveSum = $id('tzInitSaveSum');
	var tzdrawdate = $id('tzdrawdate');
	var tzSaveType = $id('tzSaveType');
	var tzDate = $id('tzDate');

	if (!checkFormPlus(tzInitSaveSum, "提取金额")){return false;}
	
    /*********************计算部分*******************/
	if (!checkFormPlus(tzDate, "存储时间")){return false;}
    //var interestRates = 0.05;//利息税率
	var days = parseInt(tzDate.value);;
	
	var tzSaveDate = tzSaveType.selectedIndex == 0 ? 1 : 7;
	if(tzSaveDate == 1){
		if(days<1){
			myAlert(tzDate, "存储时间不得小于 1 天！");
			return false;	
		}
	}else if(tzSaveDate == 7){
		if(days<7){
			myAlert(tzDate,"存储时间不得小于 7 天！");
			return false;	
		}
	}

	if (!checkFormPlus(tzFullRate, "年利率")) {return false;}
	

    var interestRates = 0.0;//利息税率
    var savetype = tzSaveType.value;//储蓄类型

    var moneynum = new Number(tzInitSaveSum.value);//提取金额
    var rate = new Number(tzFullRate.value / 100);//年利率
    
	

    var interest = moneynum * (Math.pow((1 + rate / 360), days) - 1);//应得利息
    var realInterest = interest * (1 - interestRates);
    var result1 = moneynum + realInterest;
    var result2 = interest * interestRates;
	//输出结果
    tzFullSum.value = result1.format(2);
    tzTaxSum.value = result2.format(2);
}

//form reset
function frmReset(formObj){

    formObj.reset();

}

window.onload = function(){
		frmReset($id("frmact"));
}



</script>
</head>
<body>
<div class="container" id="container">
  <form action="" method="post" id="frmact" onSubmit="return false;">
  <div class="title">
    <h2>通知存款计算器</h2>
    <div class="bg"></div>
  </div>
  <div class="content">
      
      <div class="warm_tip">
      	<p>通知存款计算器可以帮您计算通知存款的本息额。
        </p>
      </div>
      	
      <ul class="form_items">
        <li>
          <label>储蓄类型:</label>
          <span>
          <select id="tzSaveType" name="tzSaveType">
            <option value="1" selected="selected">一天通知存款</option>
            <option value="7">七天通知存款</option>
          </select>
          </span> </li>
        <li>
          <label>提取金额:</label>
          <span>
          <input value="" type="text" size="8" name="tzInitSaveSum" id="tzInitSaveSum"/> 元
          </span> </li>
        <li>
          <label>存储时间:</label>
          <span>
          <input value="1" type="text" size="8" name="tzDate" id="tzDate" /> 天
          </span> </li>
          
        <li>
          <label>年利率:</label>
          <span>
          <input value="" type="text" size="8" name="tzFullRate" id="tzFullRate"/> %
          </span> </li>  
          
      </ul>
      <div class="button_bar">
        <input type="button" onClick="tzsumcalc();" value="开始计算" class="submit" />
        <input type="button" id="hqResetBtn" value="重新计算" class="reset" onClick="frmReset(this.form)"/>
      </div>
    
  </div>
  <div class="title">
    <h2>计算结果</h2>
    <div class="bg"></div>
  </div>
  <div class="content">
    <ul class="form_items">
      <li>
        <label>实得本息总额：</label>
        <span>
        <input type="text" value="" name="tzFullSum" id="tzFullSum" readonly="readonly" disabled="true" role="disabled"/>
        </span> </li>
       
      <li>
        <label>利息税金额：</label>
        <span>
        <input type="text" value="" name="tzTaxSum" id="tzTaxSum" readonly="readonly" disabled="true" role="disabled"/>
        </span> </li> 
    </ul>
  </div>
  </form>
</div>
</body>
</html>
